#include "sweety_Render.h"
#include "components/3D/sweety_3D_Camera.h"

namespace SW
{
	Renderer* Renderer::s_Instance = nullptr;

	Renderer::Renderer() :
		m_NormalTrans(1.0f)
	{

	}

	Renderer* Renderer::GetInstance()
	{
		if (s_Instance == nullptr)
		{
			s_Instance = new Renderer();
			return s_Instance;
		}
		return s_Instance;
	}

	void Renderer::SetCurrentCamera(Camera* camera)
	{
		GetInstance()->m_CurrentCamera = camera;
	}

	Camera* Renderer::GetCurrentCamera()
	{
		return GetInstance()->m_CurrentCamera;
	}

	mat4& Renderer::GetMVPTrans()
	{
		// TODO: insert return statement here
		return GetInstance()->m_MVPTrans;
	}

	mat4& Renderer::GetMVTrans()
	{
		// TODO: insert return statement here
		return GetInstance()->m_MVTrans;
	}

	mat3& Renderer::GetNormalTrans()
	{
		return GetInstance()->m_NormalTrans;
	}

	void Renderer::RenderSprite(Sprite* sprite, const mat4& modelTrans)
	{
		if (sprite)
		{
			sprite->Render(modelTrans);
		}			
	}
}
